#ifndef __OC_NcWrapper_H__
#define __OC_NcWrapper_H__

#include "NcSyncFile.h"
#include "NcOutput.h"
#include "json/json.h"

using namespace netCDF;
namespace OCPP
{
	class NcWrapper
	{
	public:
		NcWrapper();
		~NcWrapper();
		std::shared_ptr<NcVarWrapper> findVariable(String name);
		bool open(String fileName);
		void close();
		Json::Value getVars();
		void print();
		void fixByAttr(NcOutput& ncOutput, const VolumeOptions& options);
		void extract(String varName,int levelIndex, int timeIndex, const VolumeOptions& options);
		std::shared_ptr<NcVarWrapper> getVar(String varName, bool splitDimZ, const VolumeOptions& options);
		NcOutputList read(String varName, int levelIndex, int timeIndex, const VolumeOptions& options);
		FloatVector readFloat(const NcOutput& ncOutput);

		std::shared_ptr<NcDimWrapper> getDimWrapper(String name, const VolumeOptions& options);
		void readDims();
		std::multimap<String, std::shared_ptr<NcDimWrapper> > ncDimWrapperMap;
	private:
		String _filName;
		bool dInit = false;
		std::shared_ptr<NcSyncFile> _NcSyncFile;
	};
}

#endif